New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow testing logs with @babel/helper-transform-fixture-test-runner
#10326
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11321/ |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11306/ |
@@ -141,11 +141,14 @@ export default function get(entryLoc): Array<Suite> { | |||
const taskOptsLoc = resolve(taskDir + "/options"); | |||
if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc)); | |||
|
|||
const taskLogLoc = resolve(taskDir + "/expected-log.txt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug-fixtures
in preset-env is testing against stdout.txt
and stderr.txt
. I think we could keep consistency here? And it would be great if preset-env does not log to test output after this PR gets merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
440da56
to
6228c59
Compare
} catch (e) { | ||
if (!process.env.OVERWRITE) throw e; | ||
|
||
console.log(`Updated test file: ${expectedLoc}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't restore the console.log
mock, would this line go to the actualLogs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is expected. Updated test file: foo.js
is used to remind the developer and therefore should always print to stdout, regardless of validateLogs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I meant: "You are right, I will fix it" 😅
This is used by #10325, and it would also allow to clean our tests console output and to remove the distinction between fixtures and debug-fixtures in preset-env.